#pragma once
#include "ASTreeCommon.h"
#include "clang-c\index.h"
#include <vector>
#include <string>
#include <map>

namespace AST{
class Node;
struct LeafMatch {float sim; Node* A; Node* B;};
typedef std::list<LeafMatch> MatchList;

class ASTree
{
public:
	ASTree(std::string treeName);
	~ASTree(void);

	//enums
	enum recurse{ RECURSE, ADD_ONLY, IGNORE};
	enum printFlags{ NUMBER=0x1, LABEL=0x2, MATCH=0x4, CHANGED=0x8, SIM=0x10, LEFTRIGHT=0x20};

	//member methods
	std::string getName() const;
	void test();
	Node* addNode(std::string nodeName, CXCursor cursor);
	Node* addChild(Node* parent, std::string nodeName, CXCursor cursor);
	void viewGraph();
	unsigned long getNodeCount() const;
	ASTree::recurse recurseCursor(CXCursor* cursor);
	void ASTree::leafs (std::vector<std::string>& leafNames) const;
	Graph* treeGraph() const;

	//static methods
	static std::vector<std::string> diffTrees(ASTree& A, ASTree& B);  
	static NodeMatchesMap nodeMatches;



protected:
	Graph g;
	unsigned long nodeCount;
	std::string name;
	std::vector<std::string> vertexNames;
	static void ASTree::matchLeaves(ASTree& A, ASTree& B, MatchList& matchList);
};
}//namespace AST